function residual = static_resid(T, y, x, params, T_flag)
% function residual = static_resid(T, y, x, params, T_flag)
%
% File created by Dynare Preprocessor from .mod file
%
% Inputs:
%   T         [#temp variables by 1]  double   vector of temporary terms to be filled by function
%   y         [M_.endo_nbr by 1]      double   vector of endogenous variables in declaration order
%   x         [M_.exo_nbr by 1]       double   vector of exogenous variables in declaration order
%   params    [M_.param_nbr by 1]     double   vector of parameter values in declaration order
%                                              to evaluate the model
%   T_flag    boolean                 boolean  flag saying whether or not to calculate temporary terms
%
% Output:
%   residual
%

if T_flag
    T = M15ra.static_resid_tt(T, y, x, params);
end
residual = zeros(10, 1);
    residual(1) = (T(1)*T(4)) - (params(2)*y(5)^params(7)+(params(4)-1)*y(1)/y(5)*T(5));
    residual(2) = (T(5)+params(4)*params(8)*T(4)*params(1)*T(6)) - (T(5)*params(1)*(1-params(3)+params(4)*T(6)));
    residual(3) = (y(10)) - (params(6)-params(8)*(y(1)-params(9)));
    residual(4) = (y(2)+y(4)) - (y(1));
    residual(5) = (y(1)) - (T(7)*exp(y(7))*T(8));
    residual(6) = (y(4)) - (y(3)-y(3)*(1-params(3)));
    residual(7) = (y(6)) - (y(1)/y(5));
    residual(8) = (y(7)) - (y(7)*params(5)+x(1));
    residual(9) = (y(8)) - (T(8)*T(9)-params(3));
    residual(10) = (y(9)) - (T(7)*(1-params(4))*T(10));

end
